﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Red_Gun
{
    public class Spriteset : GameFrames.Spriteset
    {
        public const int maxSpritesets = 8;
        new public static Spriteset[] myArray;
        new public static int index = 0;
        // const index integers -- for easy access
        public const int hero = 0; // contains all eight directions for hero
        public const int baseTile = 1;
        public const int flashTile = 2;
        public const int lavaTile = 3;

        public Spriteset()
        {

        }


        public static void processAllSpritesets()
        {
            for (int i = 0; i < Spriteset.myArray.Length; i++)
            {
                if (myArray[i] != null)
                {
                    myArray[i].processSpriteset();
                }
            }
        }

        public static void setUpAllSpriteSets(string[,] strings, int xMax, int yMax)
        {
            myArray = new Spriteset[yMax];

            for (int j = 0; j < yMax; j++)
            {

                myArray[j] = new Spriteset();
                myArray[j].myBitmaps = new Bitmap[xMax];

                for (int i = 0; i < xMax; i++)
                {
                    if (strings[j, i] != null)  // if there *is* an image file
                    {
                        myArray[j].addBitmap(new Bitmap(Game.buildTexture(strings[j, i]), strings[j, i]));
                    }
                    else
                    {
                        i = xMax;
                    }
                }
            }
        }

        public Spriteset(Bitmap[] bitmaps)
        {
            this.myBitmaps = new Bitmap[bitmaps.Length];
            
            for (int i = 0; i < bitmaps.Length; i++)
            {
                myBitmaps[i] = bitmaps[i];
            }

            this.indexID = index;
            myArray[this.indexID] = this;
            index++;
        }

    }
}
